package Practice1;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

public class HelloServlet2 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("HelloServlet2的doGet方法");
        ServletConfig servletConfig = getServletConfig();
        System.out.println("别名："+servletConfig.getServletName());
        System.out.println("username的值：" + servletConfig.getInitParameter("username"));
        System.out.println("url的值：" + servletConfig.getInitParameter("url"));
        System.out.println("context：" + servletConfig.getServletContext());
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("HelloServlet2的doPost方法");
    }
}
